<template>
  <el-table
    :data="tableData"
    border
    class="table-m"
    stripe>
    <el-table-column
      label="#"
      type="index"
      width="48">
    </el-table-column>
    <el-table-column
      label="权限名称"
      prop="authName">
    </el-table-column>
    <el-table-column
      label="路径"
      prop="path">
    </el-table-column>
    <el-table-column
      label="权限等级"
      prop="level">
      <template slot-scope="scope">
        <el-tag
          :type="scope.row.level === '0' ? 'primary' : scope.row.level === '1' ? 'success' : 'warning'"
        >等级{{ scope.row.level === '0' ? '一' : scope.row.level === '1' ? '二' : '三' }}
        </el-tag>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
import { getRolesList } from '@/api/rights'

export default {
  name: 'rights',
  data () {
    return {
      tableData: []
    }
  },
  created () {
    getRolesList().then(res => {
      // console.log(res.data)
      this.tableData = res.data
    })
  }
}
</script>

<style lang="less" scoped>

</style>
